<?php
// create custom plugin settings menu
add_action('admin_menu', 'bg_options_menu');

function bg_options_menu() {
  add_submenu_page('themes.php', '主题选项', '主题选项', 'manage_options', 'theme-options', 'bg_options_page' );
  //call register settings function
  add_action( 'admin_init', 'register_mysettings' );
}
function register_mysettings() {
  //register our settings
  register_setting( 'ff_options', 'banners' );
  register_setting( 'ff_options', 'options' );
}

function bg_options_page() { ?>
<style>
  .FT-optionForm textarea { width: 100%; box-sizing: border-box; height: 120px; }
</style>
<div class="wrap FT-optionForm">
  <h2>主题选项</h2>
  <form method="post" action="options.php">
      <?php settings_fields( 'ff_options' ); ?>
      <?php do_settings_sections( 'ff_options' ); ?>
      <table class="form-table">
        <tr valign="top">
          <th scope="row"><label for="banners_setting">首页横幅图片</label></th>
          <td>
            <textarea name="banners" id="banners_setting" class="code_area"><?php echo get_option('banners'); ?></textarea>
            <p class="description">每行一个，如：<code>#FFFFFF--http://sample.com/images/xxx.jpg--http://www.sample.com/</code><br>即：背景颜色--图片地址--链接；</p>
          </td>
        </tr>
        <tr>
          <th></th>
          <td><?php submit_button(); ?></td>
        </tr>
      </table>
  </form>
</div>
<?php } ?>
